package com.sanyang.pda.adapter;


import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * Created by wangshen on 2019/5/14.
 */

public class MyTitleViewPagerAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> list;
    private List<String> title;
    public MyTitleViewPagerAdapter(FragmentManager fm, List<Fragment> list, List<String> title) {
        super(fm, FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        this.list=list;
        this.title=title;
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }
    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return title.get(position);
    }
}
